<template>
<Modal
	v-model="show"
	title="详细"
	:width="1000"
	>
	<div>
		<Form :model="info" :label-width="150" style="width: 100%" :rules="ruleValidate">
			<Row>
				<Col span="12">
					<FormItem label="月份：" prop="month">
						<Input v-model="info.month" placeholder="请输入关键词" class="defwid"></Input>
					</FormItem>
				</Col>
				<Col span="12">
					<FormItem label="地区：">
						<Select v-model="info.region" placeholder="请选择地区" class="defwid">
							<Option v-for="item in companyList" :value="item.id" :key="item.id">{{ item.name }}</Option>
						</Select>
					</FormItem>
				</Col>
			</Row>
			<Row>
				<Col span="12">
					<FormItem label=" 日期：">
						<Input v-model="info.date" placeholder="请选择日期"  class="defwid"></Input>
					</FormItem>
				</Col>
				<Col span="12">
					<FormItem label=" 费用科目：">
						<Select v-model="info.subject" placeholder="请选择科目" class="defwid">
							<Option v-for="item in companyList" :value="item.id" :key="item.id">{{ item.name }}</Option>
						</Select>
					</FormItem>
				</Col>
			</Row>
			<Row>
				<Col span="12">
					<FormItem label="摘要：">
						<Input type="textarea" v-model="info.info" placeholder="" :rows="4" class="defwid"></Input>
					</FormItem>
				</Col>
				<Col span="12">
					<FormItem label="承担部门：">
						<Select v-model="info.bumen" placeholder="请选择部门" class="defwid">
							<Option v-for="item in companyList" :value="item.id" :key="item.id">{{ item.name }}</Option>
						</Select>
					</FormItem>
				</Col>
			</Row>
			<Row>
				<Col span="12">
					<FormItem label="币种：">
						<Input v-model="info.bz" placeholder="请输入关键词" value="2019-04" class="defwid"></Input>
					</FormItem>
				</Col>
				<Col span="12">
					<FormItem label="凭证编号：">
						<Select v-model="info.certificate" placeholder="请选择所在地" class="defwid">
							<Option v-for="item in companyList" :value="item.id" :key="item.id">{{ item.name }}</Option>
						</Select>
					</FormItem>
				</Col>
			</Row>
			<Row>
				<Col span="12">
					<FormItem label="收入/支出：">
						<Select v-model="info.mtype"  placeholder="请选择" class="defwid">
							<Option value="0">收入</Option>
							<Option value="1">支出</Option>
						</Select>
					</FormItem>
				</Col>
				<Col span="12">
					<FormItem label="公司主体：">
						<Select v-model="info.company_id"  placeholder="请选择所在地" class="defwid">
							<Option v-for="item in companyList" :value="item.id" :key="item.id">{{ item.name }}</Option>
						</Select>
					</FormItem>
				</Col>
			</Row>
			<Row>
				<Col span="12">
					<FormItem label="金额：">
						<Input v-model="info.money" placeholder="" value="2019-04" class="defwid"></Input>
					</FormItem>
				</Col>
				<Col span="12">
					<FormItem label="操作人：">
						<Input v-model="info.username" placeholder="" value="2019-04" class="defwid" disabled></Input>
					</FormItem>
				</Col>
			</Row>
		</Form>
	</div>
	<div slot="footer" style="text-align: center;">
		<Button type="success" size="large"  @click="einfo_ok">提交</Button>
	</div>
</Modal>
</template>

<script>


export default {
  name: 'user_bar',
  data(){
	return {
		show:false,
		info:{
			month:'',
			day:'',
			certificate:'',
			info:'',
			income:'',
			expenses:'',
			balance:'',
			region:'',
			team:'',
			subject:'',
			name:'',
		},
		ruleValidate:{
			month:[
				{ required: true, message: 'The name cannot be empty', trigger: 'blur' }
			]
		},
		companyList:[]
	};
  },
  props:['value','cinfo'],
  created(){
	this.show = this.value;
  },
  watch:{
	value(val){
		this.show = val;
	},
	show(val){
		this.$emit('input',val);
	}
  },
  methods: {
	einfo_ok(){
	
		var self = this;
		var data =  [this.info];
		var postdata = {
			data:JSON.stringify(data),
			date_month:this.info.date_month,
			company_id:this.info.id
		};
		
		Whttp.load('Chuna/Cash/update',postdata,function(result){
			self.einfo.show = false;
			self.load_data();
			self.$Message.info('提交成功');
		});
		
	},
  }
}
</script>
<style scoped>
.price{
	color: red;
    margin: 0 5px;
}
.defwid{
	width:220px;
}
</style>